//
//  Common.swift
//  SHWeibo
//
//  Created by jingming wang on 16/7/23.
//  Copyright © 2016年 cpy.name. All rights reserved.
//

import UIKit



// 微博app切换根控制器的通知
let WBSwitchRootViewControllerNoti = "WBSwitchRootViewControllerNoti"
// 表情键盘删除按钮通知
let WBEmoticonDeleteButtonNoti = "WBEmoticonDeleteButtonNoti"
// 表情键盘按钮通知
let WBEmoticonButtonsNoti = "WBEmoticonButtonsNoti"

// 微博账号
let K_WB_NAME = "rangyuan05788697@163.com"
let K_WB_PASSWD = "bbb333"

// 新浪微博相关信息
let K_APPKEY = "1949915506"
let K_APPSECRET = "f0e75f4226e77141a8f6d430f308e686"

// 回调页
let K_APPREDIRECT_URI = "http://www.baidu.com"

//app主题颜色
let K_THEME_COLOR = UIColor.orangeColor()

//屏幕宽高
let K_SCREEN_WIDTH = UIScreen.mainScreen().bounds.width
let K_SCREEN_HEIGHT = UIScreen.mainScreen().bounds.height

//RGB颜色
func RGB(red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat = 1) ->UIColor {
    return UIColor(red: red/255, green: green/255, blue: blue/255, alpha: alpha)
}

//随机颜色
func RandomColor() ->UIColor {
    let r = random()%256
    let g = random()%256
    let b = random()%256
    return RGB(CGFloat(r), green: CGFloat(g), blue: CGFloat(b))
}

//字体大小
func Font(size: CGFloat) ->UIFont {
    let font = UIFont.systemFontOfSize(size)
    return font
}

/// 打印
///
/// - parameter message:  打印内容
/// - parameter file:     类名
/// - parameter line:     行数
/// - parameter function: 方法名
func printLog<T>(message: T,file:String = __FILE__, line:Int = __LINE__, function: String = __FUNCTION__){
    // 上线后关闭打印 因为打印消耗性能
    #if DEBUG
        let f = (file as NSString).lastPathComponent
        let result = "\(f) [\(line)] \(function) : \(message)"
        print(result)
    #endif
}

